<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
// 混入模式 mixin   mixins  :扩展功能
// 缺点：1.原型污染 2.不知道混入的来源
class Hero{
    constructor(name){
        this.name = name;
    }
}

class Skills{
    run(){
        console.log("跑")
    }
    release(){
        console.log("释放技能");
    }
}

// let yase  = new Hero("亚瑟");

function mixin(receivingClass,givingCalss){
    if(typeof arguments[2] !== "undefined"){
        for(let i=2;i<arguments.length;i++){
            receivingClass.prototype[arguments[i]] = givingCalss.prototype[arguments[i]];
        }
    }
}

mixin(Hero,Skills,'run','release');
let yase  = new Hero("亚瑟");
yase.release();

// axios 
// (axios是对象 axios.get axios.put ...)  (axios 是函数 axios({}))

// 混入模式体现；
// function axios(){
//     console.log("axios");
// }
// // Object.setPrototypeOf()
// axios.__proto__['get'] = function(){
//     console.log("axios -- get");
// }
// // axios();
// axios.get();




</script>
</html>